import random

class Champion:
    def __init__(self, name, skills, hp):
        self.name = name
        self.skills = skills
        self.hp = hp
        self.is_golden = False

    def use_skill(self, target):
        if not self.skills:
            print(f"{self.name} 没有技能了!")
            return
        print(f"{self.name}发起进攻：")
        skill = self.skills.pop(0)  # 使用技能并从列表中移除

        if skill == "金身":
            self.is_golden = True
            print(f"{self.name} 用了金身!")
        else:
            print(f"{self.name} 使用了 {skill}！")
            if not target.is_golden:
                target.hp -= skill["damage"]
                print(f"{target.name} 被{skill['name']} 打并失去了 {skill['damage']} 点血! 还剩: {target.hp}点血")
            else:
                print(f"{target.name} 无法被选中!")
                target.is_golden = False  # 金身效果只持续一个技能

    def __str__(self):
        return self.name

# 定义兰陵王和小乔的技能
lanlingwang_skills = [
    {"name": "秘技·影蚀", "damage": 30},
    {"name": "秘技·分身", "damage": 40},
    {"name": "秘技·突袭", "damage": 50}
]

xiaoqiao_skills = [
    {"name": "绽放之舞", "damage": 20},
    {"name": "甜蜜恋风", "damage": 30},
    {"name": "星华缭乱", "damage": 40},
    {"name": "金身", "damage": 0}
]

# 创建角色实例
lanlingwang = Champion("兰陵王", lanlingwang_skills, hp=100)
xiaoqiao = Champion("小乔", xiaoqiao_skills, hp=100)

# 对决流程
while lanlingwang.hp>0 and xiaoqiao.hp>0:
    if random.choice([True,False]):
        xiaoqiao.use_skill(lanlingwang)
    else:
        lanlingwang.use_skill(xiaoqiao)
